<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img  src=" https://www.runoob.com/images/pic_bulboff.gif     "     id="pic"  />
    <input  type="button"  value="开灯"  onclick="kaideeng( )"   id="btn"/>

    <script>
        function   kaideeng( ){
            if(btn.value=="开灯"){
                pic.src=" https://www.runoob.com/images/pic_bulbon.gif  ";
                btn.value="关灯"

            }else{
                pic.src=" https://www.runoob.com/images/pic_bulboff.gif   ";
                btn.value="开灯"

            }



        }




    </script>

    
</body>
</html>